package com.eight.controller.api;

import com.eight.annotation.OperateLog;
import com.eight.enums.BussinessType;
import com.eight.service.OperateLogService;
import com.eight.vo.ComResult;
import com.eight.vo.OperateLogVo;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @Description: TODO
 * @Author: Van.Planifolia
 * @CreateTime: 2023-03-01  15:04
 * @Version: 1.0
 */
@RestController
public class OperateLogApi {
    @Resource
    private OperateLogService operateLogService;

    /**
     * 条件查询并且分页
     * @param operateLogVo 查询条件
     * @param pageIndex 当前页
     * @param pageSize 野种数据条数
     * @return 相应前端数据
     */
    @PostMapping("/log/selectAllOperateLog/{pageIndex}/{pageSize}")
    public ComResult selectAllOperatelog(@RequestBody OperateLogVo operateLogVo, @PathVariable Integer pageIndex, @PathVariable Integer pageSize){
        return  operateLogService.selectAllOperatelog(operateLogVo,pageIndex,pageSize);
    }

    /**
     * 根据年份来分类不同操作的占比信息
     * @param year 年份信息
     * @return 查询的结果
     */
    @GetMapping("/log/selectOperateLogByTitle/{year}")
    public ComResult selectOperateLogByName(@PathVariable String year){
        return operateLogService.selectOperateLogByName(year);
    }

    /**
     * 根据年份来分类不同ip的占比信息
     * @param year 年份
     * @return 结果
     */
    @GetMapping("/log/selectOperateLogByAddress/{year}")
    public ComResult selectOperateLogByAddress(@PathVariable String year){
        return operateLogService.selectOperateLogByAddress(year);
    }
}
